package cn.file.test;

import java.io.*;

public class ReadAndWrile {
    public static void main(String args[]) throws IOException {
        File file=new File("gao.txt");
        Reader reader=new FileReader(file);
        Writer writer=new FileWriter("qing.txt");
        char[] chars=new char[3];
        int temp=0;
        //读返回的是剩余的个数
        while ((temp=(reader.read(chars)))!=-1){
            System.out.print(temp+" ");
            String s=new String(chars,0,temp);
            writer.write(chars,0,temp);
            System.out.print(s);
        }
        writer.flush();
        if(reader!=null){
            reader.close();
        }
        if(writer!=null){
            writer.close();
        }


    }
}
